﻿<cfscript>
/** 
* ORM Term
* 
* @hint "Hibernate persistenter t_term. 定义了有关学期基本数据项" 
* 
*/ 

component 
	displayname="public.service.orm.senate.Term" 
	output=false 
	persistent=true 
	selectBeforeUpdate=true dynamicInsert=true dynamicUpdate=true 
	cacheuse="Transactional" 
	entityname="Term" 
	table="t_term"
	{

	property type="string" name="TermID" column="term_id" fieldtype="id" generator="assigned" hint="学期代码";

	property type="string" name="AcademicYear" column="academic_year" hint="学年";
	property type="string" name="AcademicTerm" column="academic_term" hint="学期";
	property type="string" name="DateStart" column="term_start" hint="学期开始日期";
	property type="numeric" name="Weeks" column="term_weeks" hint="学期计划运行周次";
	property type="string" name="TermProps" column="term_prop" hint="学期相关属性";

	property name="BookBills" type="array" lazy="true" inverse="true" cascade="delete-orphan" fieldtype="one-to-many" fkcolumn="term_id" cfc="BookBill" hint="教材出入库票据";
	property name="CETEntries" type="array" lazy="true" inverse="true" cascade="delete-orphan" fieldtype="one-to-many" fkcolumn="term_id" cfc="CETEntry" hint="四六级报名情况";
	
	property name="ClassroomTimeTables" type="array" lazy="true" inverse="true" cascade="delete-orphan" fieldtype="one-to-many" fkcolumn="term_id" cfc="ClassroomTimeTable" hint="教室时间占用情况表";
	property name="TeacherTimeTables" type="array" lazy="true" inverse="true" cascade="delete-orphan" fieldtype="one-to-many" fkcolumn="term_id" cfc="TeacherTimeTable" hint="教师排课时间占用情况表";

	property name="ClassroomBorrows" type="array" lazy="true" inverse="true" cascade="delete-orphan" fieldtype="one-to-many" fkcolumn="term_id" cfc="ClassroomBorrow" hint="学期教室借用记录";

	property name="OpenTasks" type="array" lazy="true" inverse="true" cascade="delete-orphan" fieldtype="one-to-many" fkcolumn="term_id" cfc="OpenTask" hint="单开班课程";
	property name="CommonTasks" type="array" lazy="true" inverse="true" cascade="delete-orphan" fieldtype="one-to-many" fkcolumn="term_id" cfc="CommonTask" hint="全校通选课";
	property name="ProgramPlans" type="array" lazy="true" inverse="true" cascade="delete-orphan" fieldtype="one-to-many" fkcolumn="term_id" cfc="ProgramPlan" hint="教学计划";
	property name="ProgramTasks" type="array" lazy="true" inverse="true" cascade="delete-orphan" fieldtype="one-to-many" fkcolumn="term_id" cfc="ProgramTask" hint="计划课程";

	property name="CourseBooks" type="array" lazy="true" inverse="true" cascade="delete-orphan" fieldtype="one-to-many" fkcolumn="term_id" cfc="CourseBook" hint="学期教材选用目录";
	property name="TeacherBooks" type="array" lazy="true" inverse="true" cascade="delete-orphan" fieldtype="one-to-many" fkcolumn="term_id" cfc="TeacherBook" hint="教师参考用书";

	property name="ExamPlans" type="array" lazy="true" inverse="true" cascade="delete-orphan" fieldtype="one-to-many" fkcolumn="term_id" cfc="ExamPlan" hint="教学任务考试安排计划";
	property name="ExamMiddlePlans" type="array" lazy="true" inverse="true" cascade="delete-orphan" fieldtype="one-to-many" fkcolumn="term_id" cfc="ExamMiddlePlan" hint="教学任务半期考试安排计划";
	property name="ExamTasks" type="array" lazy="true" inverse="true" cascade="delete-orphan" fieldtype="one-to-many" fkcolumn="term_id" cfc="ExamTask" hint="教学任务考试安排情况表";
	property name="ResitExamPlans" type="array" lazy="true" inverse="true" cascade="delete-orphan" fieldtype="one-to-many" fkcolumn="term_id" cfc="ExamResitPlan" hint="教学任务补考安排计划";
	property name="ResitExamTasks" type="array" lazy="true" inverse="true" cascade="delete-orphan" fieldtype="one-to-many" fkcolumn="term_id" cfc="ExamResitTask" hint="补考任务考试安排情况表";

	property name="StudentCourses" type="array" lazy="true" inverse="true" cascade="delete-orphan" fieldtype="one-to-many" fkcolumn="term_id" cfc="StudentCourse" hint="学生学期选课记录";
	property name="StudentMarks" type="array" lazy="true" inverse="true" cascade="delete-orphan" fieldtype="one-to-many" fkcolumn="term_id" cfc="StudentMark" hint="学生成绩记录";
	property name="StudentTempMarks" type="array" lazy="true" inverse="true" cascade="delete-orphan" fieldtype="one-to-many" fkcolumn="term_id" cfc="StudentMarkTemp" hint="学生成绩临时记录";
	property name="StudentResitTempMarks" type="array" lazy="true" inverse="true" cascade="delete-orphan" fieldtype="one-to-many" fkcolumn="term_id" cfc="StudentMarkResitTemp" hint="学生补考成绩临时记录";
	property name="StudentChanges" type="array" lazy="true" inverse="true" cascade="delete-orphan" fieldtype="one-to-many" fkcolumn="term_id" cfc="StudentChange" hint="学生学籍异动记录";

	property name="TaskAdjusts" type="array" lazy="true" inverse="true" cascade="delete-orphan" fieldtype="one-to-many" fkcolumn="term_id" cfc="TaskAdjust" hint="教学任务调停课记录";
	property name="TaskArranges" type="array" lazy="true" inverse="true" cascade="delete-orphan" fieldtype="one-to-many" fkcolumn="term_id" cfc="TaskArrange" hint="教学任务课程安排";
	property name="TaskMarks" type="array" lazy="true" inverse="true" cascade="delete-orphan" fieldtype="one-to-many" fkcolumn="term_id" cfc="TaskMark" hint="教学任务成绩提交状态";
	property name="TaskMarkUnlocks" type="array" lazy="true" inverse="true" cascade="delete-orphan" fieldtype="one-to-many" fkcolumn="term_id" cfc="TaskMarkUnlock" hint="已提交成绩解锁业务流";

	property name="TaskWorkloads" type="array" lazy="true" inverse="true" cascade="delete-orphan" fieldtype="one-to-many" fkcolumn="term_id" cfc="TaskWorkload" hint="教学任务工作量汇总表";
	property name="TeacherWorkloads" type="array" lazy="true" inverse="true" cascade="delete-orphan" fieldtype="one-to-many" fkcolumn="term_id" cfc="TeacherWorkload" hint="教师工作量汇总表";

	/**
	* @hint "自定义主键规则"
	* 
	* @AcademicYear "学年"
	* @AcademicTerm "学期"
	*/
	public string function getID( required string AcademicYear, required string AcademicTerm ) output=false {
		
		var nextID = mid(arguments.AcademicYear, 3, 2) & arguments.AcademicTerm;

		/* 
			主键生成规则 
			
			学期代码3位 学年开始年份后2位 + 1位季节 1-秋季 2-春季 3-夏季

			Unique: ADADEMIC_YEAR, ACADEMIC_TERM
		*/
		return nextID;
	}
	
}

</cfscript>